package com.sacfa.commons.sql;

public class TelefonoSQL {
	public static final String SELECT_ONE;
    public static final String SELECT_ALL_CLIENTE;
    public static final String SELECT_ALL_PROVEEDOR;
    public static final String SELECT_ALL_EMPLEADO;
    public static final String INSERT;
    public static final String INSERT_CLIENTE;
    public static final String INSERT_PROVEEDOR;
    public static final String INSERT_EMPLEADO;
    public static final String UPDATE;
    public static final String DELETE;
    public static final String DELETE_CLIENTE;
    public static final String DELETE_PROVEEDOR;
    public static final String DELETE_EMPLEADO;
    
    static {
        StringBuilder qryBuilder = new StringBuilder();

        qryBuilder.append("SELECT * FROM Telefono WHERE idTelefono = ?");
        SELECT_ONE = qryBuilder.toString();

        qryBuilder = new StringBuilder();
        qryBuilder.append("SELECT * FROM TelefonoCliente WHERE idCliente = ?");
        SELECT_ALL_CLIENTE = qryBuilder.toString();
        
        qryBuilder = new StringBuilder();
        qryBuilder.append("SELECT * FROM TelefonoProveedor WHERE idProveedor = ?");
        SELECT_ALL_PROVEEDOR = qryBuilder.toString();
        
        qryBuilder = new StringBuilder();
        qryBuilder.append("SELECT * FROM TelefonoEmpleado WHERE idEmpleado = ?");
        SELECT_ALL_EMPLEADO = qryBuilder.toString();
        
        qryBuilder = new StringBuilder();
        qryBuilder.append("INSERT INTO Telefono VALUES(null, ?, ?)");
        INSERT = qryBuilder.toString();
        
        qryBuilder = new StringBuilder();
        qryBuilder.append("INSERT INTO TelefonoCliente VALUES(?, ?)");
        INSERT_CLIENTE = qryBuilder.toString();
        
        qryBuilder = new StringBuilder();
        qryBuilder.append("INSERT INTO TelefonoProveedor VALUES(?, ?)");
        INSERT_PROVEEDOR = qryBuilder.toString();
        
        qryBuilder = new StringBuilder();
        qryBuilder.append("INSERT INTO TelefonoEmpleado VALUES(?, ?)");
        INSERT_EMPLEADO = qryBuilder.toString();
        
        qryBuilder = new StringBuilder();
        qryBuilder.append("UPDATE Telefono set Numero = ?, TipoTelefono = ? WHERE idTelefono = ?");
        UPDATE = qryBuilder.toString();
        
        qryBuilder = new StringBuilder();
        qryBuilder.append("DELETE FROM Telefono WHERE idTelefono = ?");
        DELETE = qryBuilder.toString();
        
        qryBuilder = new StringBuilder();
        qryBuilder.append("DELETE FROM TelefonoCliente WHERE Cliente = ? AND Telefono = ?");
        DELETE_CLIENTE = qryBuilder.toString();
        
        qryBuilder = new StringBuilder();
        qryBuilder.append("DELETE FROM TelefonoProveedor WHERE Proveedor = ? AND Telefono = ?");
        DELETE_PROVEEDOR = qryBuilder.toString();
        
        qryBuilder = new StringBuilder();
        qryBuilder.append("DELETE FROM TelefonoEmpleado WHERE Proveedor = ? AND Telefono = ?");
        DELETE_EMPLEADO = qryBuilder.toString();
    }
}
